/**
 * Projet Multicast Bidois Morgan & Thomas Nunes
 *
 */
package Test;

import Gui.ServerGUI;
import middleware.ServerMulticast;

/**
 * Launch the server
 *
 * @author Thomas
 */
public class ExecuteServer implements I_RecvMsgHandler {

    private ServerGUI guiServer;
    private ServerMulticast server;

    public ExecuteServer() {
        guiServer = new ServerGUI(this);
        guiServer.setVisible(true);
        server = new ServerMulticast(this);
        server.start();
        guiServer.setTotal(this.server.getNbGroupClientTotal());
    }

    public static void main(String[] args) {
        ExecuteServer s = new ExecuteServer();
    }

    @Override
    public void deliverCB(byte[] data) {
        System.out.println("===Le serveur lit: " + data);
    }

    public void killSomeone() {
        this.server.killSomeone();
    }

    public void askForHistoric() {
        server.askForHistoric();
    }

    @Override
    public void updateOrdered(boolean ordered, int lc) {
        guiServer.updateCorrectLbl(ordered, lc);
    }

    @Override
    public void nbClientCurrentCB(int countClient) {
        this.guiServer.setClientWait(countClient);
    }

    public void stopBurst() {
        this.server.stopBurst();
    }

    public void startBurst() {
        this.server.startBurst();
    }
}
